from datetime import datetime
from functools import wraps
def timeit(fn):
    @wraps(fn)
    def wrap(*args,**kwargs):
        st=datetime.now()
        ret=fn(*args,**kwargs)
        et=datetime.now()
        print("{} took {}s".format(wrap.__name__,(et-st).total_seconds()))
        return ret
    
    return wrap
    
    


import time
@timeit
def add(x, y):
    time.sleep(1)
    return x + y

add(1,2)
